/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_transaction_input_sale")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionInputSale.findAll", query = "SELECT p FROM PosTransactionInputSale p"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySync", query = "SELECT p FROM PosTransactionInputSale p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleId", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleId = :saleId"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleNumber", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleNumber = :saleNumber"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleName", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleName = :saleName"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleSubtotal", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleSubtotal = :saleSubtotal"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleDiscountPercent", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleDiscountPercent = :saleDiscountPercent"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleDiscountNominal", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleDiscountNominal = :saleDiscountNominal"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleTotal", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleTotal = :saleTotal"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleQuantity", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleQuantity = :saleQuantity"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleDate", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleDate = :saleDate"),
//    @NamedQuery(name = "PosTransactionInputSale.findBySaleTimestamp", query = "SELECT p FROM PosTransactionInputSale p WHERE p.saleTimestamp = :saleTimestamp")})
public class PosTransactionInputSale implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "sale_id")
    private Integer saleId;
    @Column(name = "sale_number")
    private String saleNumber;
    @Column(name = "sale_name")
    private String saleName;
    @Column(name = "sale_subtotal")
    private BigDecimal saleSubtotal;
    @Column(name = "sale_discount_percent")
    private BigDecimal saleDiscountPercent;
    @Column(name = "sale_discount_nominal")
    private BigDecimal saleDiscountNominal;
    @Column(name = "sale_total")
    private BigDecimal saleTotal;
    @Column(name = "sale_quantity")
    private BigDecimal saleQuantity;
    @Column(name = "sale_date")
    @Temporal(TemporalType.DATE)
    private Date saleDate;
    @Column(name = "sale_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date saleTimestamp;
    @JoinColumn(name = "sale_regional_id", referencedColumnName = "regional_id")
    @ManyToOne(optional = false)
    private PosMasterRegional saleRegionalId;
    @JoinColumn(name = "sale_pos_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private PosMasterUnit salePosUnitId;
    @JoinColumn(name = "sale_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit saleUnitId;
    @JoinColumn(name = "sale_user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private MasterUser saleUserId;
   
    public PosTransactionInputSale() {
    }

    public PosTransactionInputSale(Integer saleId) {
        this.saleId = saleId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getSaleId() {
        return saleId;
    }

    public void setSaleId(Integer saleId) {
        this.saleId = saleId;
    }

    public String getSaleNumber() {
        return saleNumber;
    }

    public void setSaleNumber(String saleNumber) {
        this.saleNumber = saleNumber;
    }

    public String getSaleName() {
        return saleName;
    }

    public void setSaleName(String saleName) {
        this.saleName = saleName;
    }

    public BigDecimal getSaleSubtotal() {
        return saleSubtotal;
    }

    public void setSaleSubtotal(BigDecimal saleSubtotal) {
        this.saleSubtotal = saleSubtotal;
    }

    public BigDecimal getSaleDiscountPercent() {
        return saleDiscountPercent;
    }

    public void setSaleDiscountPercent(BigDecimal saleDiscountPercent) {
        this.saleDiscountPercent = saleDiscountPercent;
    }

    public BigDecimal getSaleDiscountNominal() {
        return saleDiscountNominal;
    }

    public void setSaleDiscountNominal(BigDecimal saleDiscountNominal) {
        this.saleDiscountNominal = saleDiscountNominal;
    }

    public BigDecimal getSaleTotal() {
        return saleTotal;
    }

    public void setSaleTotal(BigDecimal saleTotal) {
        this.saleTotal = saleTotal;
    }

    public BigDecimal getSaleQuantity() {
        return saleQuantity;
    }

    public void setSaleQuantity(BigDecimal saleQuantity) {
        this.saleQuantity = saleQuantity;
    }

    public MasterUnit getSaleUnitId() {
        return saleUnitId;
    }

    public void setSaleUnitId(MasterUnit saleUnitId) {
        this.saleUnitId = saleUnitId;
    }

    public MasterUser getSaleUserId() {
        return saleUserId;
    }

    public void setSaleUserId(MasterUser saleUserId) {
        this.saleUserId = saleUserId;
    }

    public Date getSaleDate() {
        return saleDate;
    }

    public void setSaleDate(Date saleDate) {
        this.saleDate = saleDate;
    }

    public Date getSaleTimestamp() {
        return saleTimestamp;
    }

    public void setSaleTimestamp(Date saleTimestamp) {
        this.saleTimestamp = saleTimestamp;
    }

    public PosMasterRegional getSaleRegionalId() {
        return saleRegionalId;
    }

    public void setSaleRegionalId(PosMasterRegional saleRegionalId) {
        this.saleRegionalId = saleRegionalId;
    }

    public PosMasterUnit getSalePosUnitId() {
        return salePosUnitId;
    }

    public void setSalePosUnitId(PosMasterUnit salePosUnitId) {
        this.salePosUnitId = salePosUnitId;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (saleId != null ? saleId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionInputSale)) {
            return false;
        }
        PosTransactionInputSale other = (PosTransactionInputSale) object;
        if ((this.saleId == null && other.saleId != null) || (this.saleId != null && !this.saleId.equals(other.saleId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.ronsicecream.pos.entities.PosTransactionInputSale[ saleId=" + saleId + " ]";
    }
    
}
